This invention is generally related to computers and computer software. More specifically, the invention is related to dynamically providing an indication to a programmer of the efficiency of a program that is being written.
Computer programmers create and write the programs that operate computers and computer systems. Such programs consist of lines of code written in a programming language, and the lines of code are arranged to create a number of methods or routines which, executed together, form the overall program. Such methods and routines generally utilize a plurality of defined functions that perform specific tasks within the routines and the created program.
Programmers will generally create or write programs within a an integrated development environment that provides tools that enhance a programmers ability to develop a program. Such integrated development environments are programs themselves that are being run in the background as the programmer writes code. Depending upon the language in which the program is written, building block elements are utilized for enhancing the programmers ability to use functions to create specific routines and methods of the program being written. For example, one available integrated development environment is referred to as Visual Age, available from International Business Machines Corporation,. A Visual Age environment, for example, for the JAVA programming language utilizes a JAVA Development Kit or JDK. JDK includes a plurality of building block functions that may be used for creating the various routines or methods of a program.
When computer programs are created and executed, the time required for the program""s execution is always a primary concern. While the speed of the hardware in a computer is constantly being improved, it is also a desirable objective for the software programs to be more efficient as well. Generally, programmers will not know the time that is required for execution of their program until they have completed the program and it is formally run or executed. Even then, a determined execution time for a program is only indicative of the time for the entire program to run. Therefore, it is often difficult to pinpoint how a program proceeds and how it might be made more efficient based upon an overall program execution time. For example, inefficient or improper loops might be utilized within the program which significantly increase its execution time. Furthermore, various building block functions are expensive with respect to the specific execution time they require, and thus, such functions increase the overall time to run a particular program. Again, knowing the execution time of the entire program is little help in helping a programmer to pinpoint where inefficient or expensive routines might be eliminated or modified for the purposes of decreasing the overall execution time of the program.
Other performance statistics for a program are also of interest. For example, the instruction count of a program may be indicative of an inefficient program. Furthermore, the number of system cycles per instruction or xe2x80x9ccpixe2x80x9d for a program may also highlight inefficiencies. However, such inefficiencies in existing development environments are difficult to pinpoint.
Accordingly, it is an objective of the present invention to enhance the efficiency of software programs.
It is another objective of the present invention to educate a programmer with respect to the efficiency of a program that is being written.
To that end, it is desirable to bring expensive and inefficient functions, routines or methods to the attention of the programmer so that such expensive elements might be avoided or efficiently modified within the program code.
The present invention addresses the above-objectives by providing an indication to a programmer of the efficiency of a created program that is being written. The indication is provided dynamically while the program is written, and the invention monitors the insertion and deletion of one or more functions within the program being written and determines a performance statistic for the function which is indicative of the efficiency of the function. After the performance statistic is determined, a humanly-perceptible output, such as a message on a display screen, is provided to a programmer and is reflective of the performance statistic of the function. This provides an indication to the programmer related to the efficiency of the created program. In accordance with one embodiment of the present invention, the performance statistic is an execution time statistic which is indicative of the amount of time that the function requires to execute. In alternative embodiments of the invention, the performance statistic might be any statistic which provides an indication with respect to the efficiency of the program, such as an instruction count statistic or a cycles per instruction (cpi) statistic, for example.
In accordance with one embodiment of the present invention, a counter is maintained that is indicative of the cumulative performance statistics associated with a plurality of functions within a created program. The counter is updated when functions are inserted and deleted within the created program, and the output provided to the programmer corresponds to the value of the counter. Thus, the efficiency of a routine or method created by function insertions/deletions may be monitored and an output provided to the programmer. Performance statistics may exist for a plurality of preexisting functions wherein when one of the preexisting functions is inserted or deleted within the program, a preexisting performance statistic is obtained and provided to the programmer. For example, a table of such preexisting performance statistics may exist, and the table may be referred to when a preexisting function is added or deleted within the created program.
In an alternative embodiment of the invention, a performance statistic of a function may be obtained by executing the function in real time, and then based upon the execution of the function a performance statistic is generated for the function.
Preferably, the output corresponding to the performance statistic is displayed on a display screen proximate a line of code entered in the created program which corresponds to a particular function added to the created program. Furthermore, it is desirable to provide the output generally contemporaneously with the insertion or deletion of a function within the created program so that a programmer is aware of inefficient or time consuming function soon after they are inserted in or deleted from the created program.